package com.shujia.rec.util;

import com.shujia.util.Config;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.client.HConnection;
import org.apache.hadoop.hbase.client.HConnectionManager;

import java.io.IOException;

public class HbaseUtil {

    private static HConnection connection;

    static {
        Configuration configuration = new Configuration();
        configuration.set("hbase.zookeeper.quorum", Config.getString("hbase.zookeeper.connect"));
        try {
            connection = HConnectionManager.createConnection(configuration);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static HConnection getConnection() {
        return connection;
    }
}
